package com.yeyuan.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.yeyuan.dao.IUserDao;
import com.yeyuan.entity.User;
@Repository
public class UserDaoImpl implements IUserDao{
	
	@Resource
	SqlSessionTemplate sqlSessionTemplate;
	
	@Override
	public User getUserByUserName(String userName) {
		return (User) sqlSessionTemplate.selectOne("User.getUserByUserName",userName);
	}

	@Override
	public User getResultByUser(User user) {
		return  (User) sqlSessionTemplate.selectOne("User.loginUser", user);
	}

	@Override
	public User registerUser(User user) {
		sqlSessionTemplate.insert("User.registerUser", user);
		return user;
	}

	@Override
	public User getUserByUserID(String userID) {
		return (User) sqlSessionTemplate.selectOne("User.getUserByUserID",userID);
	}

}
